#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

void swap(int &a, int &b)
{
    int tmp = a;
    a = b;
    b = tmp;
}


int main(int argc, char **argv)
{
    vector<int> nums;

    for (int i = 0; i < 2; i++) {
        int in = rand()%3;
        cout << in << " ";
        nums.push_back(in);
    }
    cout << endl;

    int i = -1, j = 0, k = nums.size();

    while ( j < k) {
        if (nums[j] == 0) {
            i++;
            swap(nums[i], nums[j]);
        } else if (nums[j] == 1) {
            j++;
        } else {
            k--;
            swap(nums[k], nums[j]);
        }
    }
    
    for (int i = 0; i < nums.size();  i++) 
        cout << nums[i] << " "; 
    cout << "-----------------Test 1--------------------" << endl;


    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
